package ar.edu.itba.tp1.gps.api;

import java.util.ArrayList;
import java.util.List;

import ar.edu.itba.tp1.gps.GPSRun;
import ar.edu.itba.tp1.gps.board.ArithmeticsRestrictions;
import ar.edu.itba.tp1.gps.board.Coordinate;

public class GPSProblemImpl implements GPSProblem {

	protected List<GPSRule> rules;
	private ArithmeticsRestrictions restrictions;

	public GPSProblemImpl(ArithmeticsRestrictions restrictions) {
		this.rules = new ArrayList<GPSRule>();
		this.restrictions = restrictions;

		for (int i = 0; i < GPSRun.n; i++) {
			for (int j = 0; j < GPSRun.n; j++) {
				for (int k = 1; k <= GPSRun.n; k++) {
					rules.add(new GPSRuleImpl(k, new Coordinate(i, j), this.restrictions));
				}
			}
		}
	}

	@Override
	public GPSState getInitState() {
		return new GPSStateImpl();
	}

	@Override
	public GPSState getGoalState() {
		throw new UnsupportedOperationException("The problem doesn't have a single goal state.");
	}

	@Override
	public List<GPSRule> getRules() {
		return this.rules;
	}

	@Override
	public Integer getHValue(GPSState state) {
		throw new UnsupportedOperationException("The heuristics are not implemented.");
	}

}
